package com.wz.service;

import com.wz.dao.UserInfoMapper;
import com.wz.pojo.Department;
import com.wz.pojo.UserInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

/**
 * @author 2019
 * 增删改查
 */
@Service
public class UserInfoSerivceImpl implements UserInfoSerivce {

    /**
     * 写它是为了
     * 调用userInfoMapper里的
     * 方法-getAllUser()
     */
    @Autowired
    private UserInfoMapper userInfoMapper;


    /**展示说有员工信息*/
    @Override
    public List<UserInfo> getAllUser() {
        return  userInfoMapper.getAllUser();
    }

    /**add员工数据*/
    @Override
    public int addEmp(UserInfo userInfo) {
        return userInfoMapper.addEmp(userInfo);
    }


    /**根据UserID查询数据    作为修改页面跳转原始数据使用*/
    @Override
    public UserInfo getUserById(Integer userID) {
        return userInfoMapper.getUserById(userID);
    }

    /**update员工*/
    @Override
    public int upDate(UserInfo userInfo) {
        return userInfoMapper.upDate(userInfo);
    }

    /**delete员工信息*/
    @Override
    public int deleteUserById(Integer userID) {
        return  userInfoMapper.deleteUserById(userID);
    }

    /**模糊查询*/
    @Override
    public List<UserInfo> searchByKeyWord(String userName) {
        return userInfoMapper.searchByKeyWord(userName);
    }

    /**下拉框查询*/
    @Override
    public List<UserInfo> slsectUser(Integer did) {
        return userInfoMapper.slsectUser(did);
    }
}
